package com.neusmart.tongrentang.dialog;

import android.content.Context;
import android.view.View;

import com.neusmart.common.dialog.BaseDialog;
import com.neusmart.tongrentang.R;

/**
 * Topic Detail Menu Dialog
 * <p/>
 * roy
 */
public class TopicDetailMenuDialog extends BaseDialog implements View.OnClickListener {

    private OnTopicMenuItemClickListener listener;

    public TopicDetailMenuDialog(Context context) {
        super(context, R.style.DialogTheme);
        init();
    }

    @Override
    protected int getLayoutResID() {
        return R.layout.topic_detail_menu_dialog;
    }

    @Override
    protected void initView() {
        mainView = findViewById(R.id.main);
    }

    @Override
    protected void setListener() {
        super.setListener();
        int[] resIds = {R.id.topic_detail_menu_ll_wechat_share, R.id.topic_detail_menu_ll_wechat_friends_share,
                R.id.topic_detail_menu_ll_sina_weibo_share, R.id.topic_detail_menu_ll_collect,
                R.id.topic_detail_menu_ll_report, R.id.topic_detail_menu_ll_cancel};
        for (int id : resIds)
            findViewById(id).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.topic_detail_menu_ll_wechat_share:
                if (listener != null)
                    listener.onWeChatShare();
                break;
            case R.id.topic_detail_menu_ll_wechat_friends_share:
                if (listener != null)
                    listener.onWeChatMomentsShare();
                break;
            case R.id.topic_detail_menu_ll_sina_weibo_share:
                if (listener != null)
                    listener.onSinaShare();
                break;
            case R.id.topic_detail_menu_ll_collect:
                if (listener != null)
                    listener.onCollect();
                break;
            case R.id.topic_detail_menu_ll_report:
                if (listener != null)
                    listener.onReport();
                break;
            case R.id.topic_detail_menu_ll_cancel:
                break;
            default:
                break;
        }
        dismiss();
    }

    public void setOnTopicMenuItemClickListener(OnTopicMenuItemClickListener listener) {
        this.listener = listener;
    }

    public interface OnTopicMenuItemClickListener {
        void onWeChatShare();

        void onWeChatMomentsShare();

        void onSinaShare();

        void onCollect();

        void onReport();
    }
}
